<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
<link href="/css/amazeui.min1.css" rel="stylesheet" type="text/css" />
<link href="/user/css/style.css" rel="stylesheet" type="text/css" />
<script src="/user/js/jquery.js"></script>
<script src="/skin/js/toast.js"></script>
<meta name="Keywords" content="" />
<meta name="Description" content="" />
<title>会员注册</title>
<style>
/* 设计稿 375px，1rem = 100px，换算方法：px值 ÷ 100 = rem值 */
a{-webkit-tap-highlight-color:transparent;outline:none;}
body{background:#f3f5f8;margin:0;padding:0;}

/* 注册页面布局 */
.reg-container{
	min-height:100vh;
	padding:0.16rem;
}

/* 表单卡片 */
.reg-form{
	background:#fff;
	border-radius:0.12rem;
	padding:0.24rem;
	box-shadow:0 0.02rem 0.08rem rgba(0,0,0,0.04);
	margin-bottom:0.16rem;
}

/* 表单项 */
.form-item{
	margin-bottom:0.2rem;
}
.form-item:last-child{
	margin-bottom:0;
}

.form-label{
	font-size:0.14rem;
	color:#64748b;
	margin-bottom:0.08rem;
	font-weight:500;
}

.form-input{
	width:100%;
	height:0.44rem;
	border:0.01rem solid #e5e7eb;
	border-radius:0.08rem;
	padding:0 0.12rem;
	font-size:0.14rem;
	outline:none;
	box-sizing:border-box;
	background:#fff;
}
.form-input:focus{
	border-color:#253043;
}
.form-input::placeholder{
	color:#94a3b8;
}

/* 验证码输入框 */
.code-input-group{
	display:flex;
	gap:0.12rem;
	align-items:center;
}
.code-input-group .form-input{
	flex:1;
}
.code-btn{
	height:0.44rem;
	padding:0 0.16rem;
	background:#253043;
	color:#fff;
	border:none;
	border-radius:0.08rem;
	font-size:0.13rem;
	cursor:pointer;
	white-space:nowrap;
	-webkit-tap-highlight-color:transparent;
	font-weight:600;
}
.code-btn:active{
	opacity:0.8;
}
.code-btn:disabled{
	background:#94a3b8;
	cursor:not-allowed;
}

/* 提交按钮 */
.submit-btn{
	width:100%;
	height:0.48rem;
	background:#253043;
	color:#fff;
	border:none;
	border-radius:0.08rem;
	font-size:0.16rem;
	font-weight:700;
	cursor:pointer;
	-webkit-tap-highlight-color:transparent;
	margin-top:0.24rem;
}
.submit-btn:active{
	opacity:0.8;
}

/* 底部链接 */
.bottom-links{
	text-align:center;
	margin-top:0.24rem;
	font-size:0.14rem;
	color:#64748b;
}
.bottom-links a{
	color:#253043;
	text-decoration:none;
	font-weight:600;
}
.bottom-links a:active{
	opacity:0.8;
}
</style>
<script>
	// 设计稿 375px，1rem = 100px，换算方法：px值 ÷ 100 = rem值
	(function(){
		var docEl = document.documentElement;
		var resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize';
		function recalc() {
			var clientWidth = docEl.clientWidth;
			if (!clientWidth) return;
			docEl.style.fontSize = (clientWidth / 375 * 100) + 'px';
		}
		if (!document.addEventListener) return;
		window.addEventListener(resizeEvt, recalc, false);
		document.addEventListener('DOMContentLoaded', recalc, false);
		recalc();
	})();
</script>
</head>
<body class="body">
<header id="header">
	<section class="head-b head-b1">
		<span class="u-left"><a href="javascript:history.go(-1);" class="back"><img src="/skin/img/back.png"></a></span>
		<h1 id="t0">会员注册</h1>
		<div class="u-right"></div>
	</section>
</header>

<div class="reg-container">
	<form class="reg">
		<div class="reg-form">
			<!-- 账户 -->
			<div class="form-item">
				<div class="form-label">账户</div>
				<input id="uname" type="text" name="t0" class="form-input" placeholder="账户为8-16位任意字母数字" />
			</div>
			
			<!-- 手机号 -->
			<div class="form-item">
				<div class="form-label">手机号</div>
				<input id="mobile" type="text" name="t1" class="form-input" placeholder="请填写11位手机号" />
			</div>
			
			<!-- 验证码 -->
			<div class="form-item">
				<div class="form-label">验证码</div>
				<div class="code-input-group">
					<input type="text" name="code" class="form-input" placeholder="请填写验证码" />
					<button type="button" class="code-btn yzm" onclick="yzm()">发送验证码</button>
				</div>
			</div>
			
			<!-- 姓名 -->
			<div class="form-item">
				<div class="form-label">姓名</div>
				<input type="text" name="t3" class="form-input" placeholder="请填写姓名" />
			</div>
			
			<!-- 密码 -->
			<div class="form-item">
				<div class="form-label">密码</div>
				<input type="password" name="t4" class="form-input" placeholder="请输入6位以上密码" />
			</div>
			
			<!-- 确认密码 -->
			<div class="form-item">
				<div class="form-label">确认密码</div>
				<input type="password" name="t5" class="form-input" placeholder="请再次输入密码" />
			</div>
			
			<!-- 邀请码 -->
			{if($msg==0)}
			<div class="form-item">
				<div class="form-label">邀请码</div>
				<input type="text" class="form-input" name="t7" placeholder="请填写邀请码" value=""/>
			</div>
			{else}
			<input type="hidden" value="{$code}" name="t7" />
			<div class="form-item">
				<div class="form-label">邀请码</div>
				<input type="text" class="form-input" name="t7" placeholder="请填写邀请码" value="{$code}"/>
			</div>
			{/if}
		</div>
		
		<!-- 提交按钮 -->
		<button class="submit-btn" type="button" onclick="reg();">立即注册</button>
		
		<!-- 底部链接 -->
		<div class="bottom-links">
			已有账号？<a href="login.php">去登录</a>
		</div>
	</form>
</div>

<script>
	function yzm(){
		mobile = $("#mobile").val();
		if(mobile.length!=11){
			showToast("请输入正确的手机号", 'error');return;
		}else{
			let uname = $("#uname").val();
		$.ajax({
			type:"post",
			dataType:"json",
			url:"/Moudelu.php?m=m&a=yzm",
			data:"mobile="+mobile+"&uname="+uname,
			success:function(d){
				if(d[0]==0){
					showToast(d[1], 'error');
				}
				else{
					showToast(d[1], 'success');
					$('.yzm').attr("disabled","disabled");
					
					countDown(60);
				}
			}
		});
		}
	}
	
	function countDown(i) {	
		i = i - 1;
		$(".yzm").html(i+"秒后重新发送");  
		if (i == 0) {  
			$(".yzm").html("重新发送");
			$('.yzm').removeAttr("disabled");
			flag = 1;  
			i = 60;  
			return;  
		}			
		setTimeout('countDown('+i+')',1000);  
	} 
	
	function reg(){
		$.ajax({
			type:"post",
			dataType:"json",					
			url:"/Moudelu.php?m=m&a=reg",
			data:$(".reg").serialize(),
			success:function(d){
				if(d[0]==0){
					showToast(d[1], 'error');
				}
				else{
					showToast(d[1], 'success');
					window.location.href='success.php';
				}
			}
		});
	}
</script>
</body>
</html>
